package org.nmgyjt.springboot.beans.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class ServiceAccountVo implements Serializable {

    private static volatile ServiceAccountVo serviceAccountVo;

    private static final long serialVersionUID = 1;

    private String url;
    private String clientId;

    private String p;

    private String kty;

    private String q;

    private String d;

    private String e;

    private String use;

    private String kid;

    private String qi;

    private String dp;

    private String dq;

    private String n;

    private String loginUrl;

    private String loginRedirectUri;

    private String loginGrantType;

    private String loginClientSecret;

    private String loginClientId;


    private ServiceAccountVo() {
    }

    private ServiceAccountVo(String url, String clientId, String p, String kty, String q, String d, String e,
                             String use, String kid, String qi, String dp, String dq, String n ,
                             String loginUrl, String loginRedirectUri , String loginGrantType, String loginClientSecret, String loginClientId){
        this.url=url;
        this.clientId = clientId;
        this.p = p;
        this.kty = kty;
        this.q = q;
        this.d = d;
        this.e = e;
        this.use = use;
        this.kid = kid;
        this.qi = qi;
        this.dp = dp;
        this.dq = dq;
        this.n = n;
        this.loginUrl = loginUrl;
        this.loginRedirectUri = loginRedirectUri;
        this.loginGrantType = loginGrantType;
        this.loginClientSecret = loginClientSecret;
        this.loginClientId = loginClientId;
    }

    public static ServiceAccountVo getInstance(String url,String clientId, String p, String kty, String q, String d, String e,
                                               String use, String kid, String qi, String dp, String dq, String n,String loginUrl,
                                               String loginRedirectUri ,String loginGrantType,String loginClientSecret,String loginClientId){
        if(serviceAccountVo==null){
            synchronized (ServiceAccountVo.class){
                if(serviceAccountVo==null){
                    serviceAccountVo = new ServiceAccountVo( url,clientId,  p,  kty,  q,  d,  e,
                            use,  kid,  qi,  dp,  dq,  n ,loginUrl,loginRedirectUri,loginGrantType, loginClientSecret,loginClientId);
                }
            }
        }
        return serviceAccountVo;
    }

}
